package nc.ui.zujin.price;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import nc.ui.trade.bsdelegate.BDBusinessDelegator;
import nc.vo.pub.CircularlyAccessibleValueObject;
import nc.vo.pub.SuperVO;
import nc.vo.qth.pub.crowno.sort.CrownoSort;

public class ClientBusinessDelegator extends BDBusinessDelegator {
	
	public ClientBusinessDelegator() {
		super();
	}
	
	@Override
	public SuperVO[] queryHeadAllData(Class headClass, String strBillType,
			String strWhere) throws Exception {
		return super.queryHeadAllData(headClass, strBillType, strWhere);
	}
	@Override
	public CircularlyAccessibleValueObject[] queryBodyAllData(Class voClass,
			String billType, String key, String strWhere) throws Exception {
		SuperVO[] vos = (SuperVO[])super.queryBodyAllData(voClass, billType, key, strWhere);
		if (vos != null && vos.length>0) {
			List<SuperVO> list = Arrays.asList(vos);
			CrownoSort sort = new CrownoSort("crowno");
			Collections.sort(list, sort);
			SuperVO[] v = (SuperVO[])Array.newInstance(vos[0].getClass(), list.size());
			return list.toArray(v);
		}else{
			return null;
		}
	}
}
